window.onload=function() {
    var user_name=document.getElementById("user_name");
    var user_password=document.getElementById("user_password")
    var user_enroll=document.getElementById("user_enroll")
    var user_register=document.getElementById("user_register")
    user_enroll.onclick=function(){
        var UserName=user_name.value;
        var userPassword=user_password.value;
        $.ajax({
            type:"post",
            url:"http://118.195.129.130:3000/user/login",
            async:true,
            data:{
                us:UserName,
                ps:userPassword
            },
            success:function(data){
                console.log(data);
                if(data.err==0){
                    window.location.href="template/index.html";
                }
                if(data.err==-1){
                    alert("用户名或密码错误")
                }
            },
            error:function(err){
                console.log("错误");
            }
        });
    }




    
}